class Student:
    def __init__(self, name, score):# 定义构造函数，初始化学生姓名和成绩
        self.name = name
        self.score = score

    def __str__(self):# 重写__str__方法，使得打印对象时，输出更加友好
        return f"学生 {self.name} 的成绩是 {self.score}"


class xitong:
    def __init__(self):
        self.students = []

    def A(self, name, score):
        new_student = Student(name, score)
        self.students.append(new_student)
        print(f"学生 {name} 的记录已添加.")

    def B(self, name):
        for i, student in enumerate(self.students):
            if student.name == name:
                del self.students[i]
                print(f"学生 {name} 的记录已删除.")
                return
        print(f"未找到学生 {name}.")

    def C(self, name):
        for student in self.students:
            if student.name == name:
                print(student)
                return
        print(f"未找到学生 {name}.")

    def D(self, name, new_score):
        for student in self.students:
            if student.name == name:
                student.score = new_score
                print(f"学生 {name} 的成绩已更新为 {new_score}")
                return
        print(f"未找到学生 {name}.")

    def run(self):
        while True:
            print("\n学生成绩管理系统")
            print("1. 添加学生记录")
            print("2. 删除学生记录")
            print("3. 查找学生记录")
            print("4. 修改学生记录")
            print("5. 退出系统")

            choice = input("请选择操作 (1-5): ")

            if choice == '1':
                name = input("请输入学生姓名: ")
                score = float(input("请输入学生成绩: "))
                self.A(name, score)
            elif choice == '2':
                name = input("请输入要删除的学生姓名: ")
                self.B(name)
            elif choice == '3':
                name = input("请输入要查找的学生姓名: ")
                self.C(name)
            elif choice == '4':
                name = input("请输入要修改的学生姓名: ")
                new_score = float(input("请输入新的成绩: "))
                self.D(name, new_score)
            elif choice == '5':
                print("感谢使用学生成绩管理系统!")
                break
            else:
                print("无效的选择，请重新输入.")


if __name__ == "__main__":
    system = xitong()
    system.run()
